<?php
/**
 * @author Radovan Dvorsky
 * @version 20100401
 */
require_once ('application/default/models/Db/Mapper/MapperAbstract.php');

class Db_Mapper_Student extends Db_Mapper_Abstract {
	
	/**
	 * Vrati z databaze vsetkych studentov vratane mena skupiny, do ktorej
	 * patria
	 * 
	 * TODO treba pridať podmienku, ktorú bude selectovať len studentov, ktorych treba
	 * vyskúšať
	 * 
	 * @return Zend_Db_Table_Rowset
	 */
	public function fetchStudentsWithGroups(){
		
		$select = $this->getTable()->select(Zend_Db_Table::SELECT_WITH_FROM_PART);
		$select->setIntegrityCheck(false)			
		->join('Student_has_Tridy','Student.ID_st = Student_has_Tridy.Student_ID_st')
		->join('T_Tridy','Student_has_Tridy.T_Tridy_ID_tr = T_Tridy.ID_tr')
		->order('Student.prijmeni');			
		
		return $this->getTable()->fetchAll($select);		
	}
}

?>